﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Ovvio.Web.Areas.Admin.Models.CatalogueModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Catalogue
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% Html.Telerik().Grid(Model)
        .Name("CatalogueGrid")
        .DataKeys(keys => { keys.Add(p => p.Id).RouteKey("Id"); })
        .Sortable()
        .Scrollable(scroll => scroll.Height(320))
        .DataBinding(dataBinding => dataBinding.Server()
        .Update ("Update", "Catalogue"))
        .Columns(columns =>
        {
            columns.Template(o => 
            { %> 
                <div style="width:50; height:50">
                    <img  src="<%= Url.Action("Thumb/" + o.Id.ToString()) %>" alt="<%= o.Name %>" style="max-width:50; max-height:50"/>
                </div>
            <% }).Width(60);
            columns.Template(o => @Html.ActionLink(o.Name, "Edit", "Products", new { id = o.Id }, null)).Title("Name").Width(300);
            columns.Template(o => @Html.ActionLink("Promo Details", "Details", "Promos", new { id = o.PromoId }, null)).Width(100);

            columns.Bound(o => o.Rating).Width(100);

            columns.Bound(o => o.IsPublished).Width(80);
            columns.Bound(o => o.IsOnStock).Width(80);

            columns.Bound(o => o.ItemType).Title("Category").Width(180);
            columns.Command(command => { command.Edit().ButtonType(GridButtonType.BareImage); }).Width(100);
        })
        .Editable(editing => editing.Mode(GridEditMode.InLine))
        .Render();
    %>

</asp:Content>

